package com.david.func_test.activity

import android.app.Activity
import android.os.Bundle
import android.view.View
import com.david.func_test.R
import com.david.func_test.StepUtil

class TestActivity:Activity() {
    var stepUtil: StepUtil? = StepUtil()
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_test)
        findViewById<View>(R.id.tv_test).setOnClickListener {

        }

        if (stepUtil?.isSupportStepCountSensor(this) == true) {
            stepUtil?.checkPermission(this)
        }
    }

    override fun onRequestPermissionsResult(
        requestCode: Int,
        permissions: Array<out String>,
        grantResults: IntArray
    ) {
        super.onRequestPermissionsResult(requestCode, permissions, grantResults)
        stepUtil?.checkPermissionResult(requestCode, permissions, grantResults)
    }

    override fun onDestroy() {
        super.onDestroy()
        stepUtil?.onDestroy()
        stepUtil = null
    }
}